/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.admin.service;

import org.springblade.modules.admin.entity.RescueNoticeTask;
import org.springblade.modules.admin.vo.RescueNoticeTaskVO;
import org.springblade.core.mp.base.BaseService;
import com.baomidou.mybatisplus.core.metadata.IPage;

/**
 * 救援通知任务表 服务类
 *
 * @author ysq
 * @since 2025-07-10
 */
public interface IRescueNoticeTaskService extends BaseService<RescueNoticeTask> {

	/**
	 * 自定义分页
	 *
	 * @param page
	 * @param rescueNoticeTask
	 * @return
	 */
	IPage<RescueNoticeTaskVO> selectRescueNoticeTaskPage(IPage<RescueNoticeTaskVO> page, RescueNoticeTaskVO rescueNoticeTask);

	RescueNoticeTask getById(Long id);

	/**
	 * 通知轮次
	 */
    void notifyRound(RescueNoticeTask task, int round);

	/**
	 * 呼叫回调
	 */
	void onCallResult(String body);

	/**
	 * 检查是否所有人都未打通，如是则进入下一轮，否则流程结束
	 * 场景区分：
	 * - 回调场景(isTimeout=false)：仅当本轮所有明确定义为未打通(3)时才进入下一轮
	 * - 超时场景(isTimeout=true)：只要本轮没有人打通(2)，其余状态均视为未打通
	 * @param task 任务
	 * @param currentRound 当前轮次
	 * @param isTimeout 是否为超时触发
	 */
	void checkAndNotifyNextRoundIfNeeded(RescueNoticeTask task, int currentRound, boolean isTimeout);
}
